package com.hgm.study

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.ui.Modifier
import androidx.core.view.WindowCompat
import com.hgm.study.ui.components.NavHostApp
import com.hgm.study.ui.screens.MainFrame
import com.hgm.study.ui.theme.StudyAppTheme

class MainActivity : ComponentActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            //获取状态栏高度
            //var statusBarHeight = 0
            //val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
            //if (resourceId > 0) {
            //      statusBarHeight = resources.getDimensionPixelSize(resourceId)
            //}

            //让主主体内容显示在状态栏、导航栏后面
            WindowCompat.setDecorFitsSystemWindows(window,false)
            //处理部分机型状态栏不透明和导航栏问题
            //window.statusBarColor = Color.Transparent.value.toInt()
            //window.decorView.systemUiVisibility =
            //      View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE

            setContent {
                  StudyAppTheme {
                        Surface(
                              modifier = Modifier.fillMaxSize(),
                              color = MaterialTheme.colors.background
                        ) {
                              NavHostApp()
                        }
                  }
            }
      }
}